package com.ufida.lyc.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class LoginController extends HttpServlet {

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String user = request.getParameter("user");
		String pwd = request.getParameter("pwd");
		HttpSession session = request.getSession();
		if("admin".equals(user) && "admin".equals(pwd)){
			session.setAttribute("user", "admin");
		}else{
			session.setAttribute("user", null);
		}
		session.setAttribute("Result", null);
		request.getRequestDispatcher("index.jsp").forward(request,response);
	}
}
